Skip to content

fix(context): preserve message authorship and memory authority - #168

Merged
ScriptedAlchemy merged 11 commits into
mainfrom
fix/agent-message-provenance
Nov 19, 2026
Merged

ScriptedAlchemy merged 11 commits into
mainfrom
fix/agent-message-provenance

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Problem

T3 persisted sender metadata but dropped it while constructing provider input, summaries and learning evidence. An agent report or system notification could become a human instruction and survive in saved memory. The deeper inspection also reproduced two handoff races: a memory forgotten during context preparation could still be sent from an already-rendered excerpt.

This PR is stacked on #166 (fix/project-memory-isolation-curation). Its head includes the latest automatic-cleanup base. Merge it into that branch before landing #166 on main.

Changes

  • Carry sender identity through turn start, steering, portable history, summaries, learning, search, MCP results and source inspectors. Include provenance in evidence hashes so attribution changes invalidate old derived content.
  • Recover structured historical attribution from matching canonical records before selection and budgeting. Preserve explicit attribution when recovery is unavailable, and mark otherwise unattributed user-shaped entries as unknown.
  • Mark legacy text-only general and side-chat summaries as historical evidence with unverified sender attribution. Claimed user instructions or approvals in that text must be checked against the original conversation.
  • Revalidate historical memory after native pending-receipt persistence and after inline prepared-knowledge persistence, immediately before provider consumption. On changed evidence, restore unsent handoff markers, mark inline knowledge delivery failed, and retry preparation once with current evidence and recalculated budgets. This closes both reproduced forget races without holding a database lock over provider I/O.
  • Gate native goal, compaction and sign-out commands on actor identity before side effects. Peer command-shaped text remains attributed peer input; direct human commands and intended server automation remain supported.
  • Skip automatic recall for nonhuman messages, notifications, delegated completions and explicit instruction revisions. Disable automatic capture and recall for the canonical scratch project, including when Git probing is unavailable.
  • Require available human support or explicit owner restoration before nonhuman standing claims enter automatic recall. Preserve source validation after restoration and revoke that approval when an agent rewrites the content. Repetition from one agent across threads is not independent support.
  • Integrate fix(memory): isolate project access and automate memory cleanup #166's fully automatic removal: task/code proposals, including unsupported agent-only learning, are discarded before persistence. Curator retirements permanently erase fact content, revisions and stored delivery copies; eligible older retired records are cleaned in the background. There is no staging area, confirmation or review queue. Preserve source conversations, supported replacements and owner protections.
  • Provide attributed, bounded curator evidence, isolate Codex extraction, and align the group-conversation eval digest with the production historical-summary formatter.

Deeper inspection and validation

The legacy-summary attribution gap and both forget races were reproduced with failing regressions before their fixes.

  • 367 focused and integration cases passed: 115 knowledge/curation/learning cases; 200 handoff, turn-start, handoff-service and group-eval cases; 52 MCP and group-conversation integration cases.
  • The inline race uses a real SQLite prepared-write hook and verifies prepared → failed → prepared → sent, with one provider start. Native coverage forgets during pending persistence and verifies that the removed excerpt never reaches injection.
  • 8 React compiler checks passed. Final focused Effect/TypeScript checks passed for the server, web and mobile changes and their test import graphs.
  • Formatting, lint, both unused-code passes, GraphQL validation and the native addon build passed.
  • The required vp run check:changed HEAD --concurrency 1 --skip-tests command ran. Its cached typecheck launcher cannot initialize the workspace's nested seccomp supervisor; the direct focused checks above passed. Behavioral tests ran separately. Local Chromium cannot create its required socket, so the updated browser interaction regression awaits hosted CI.
  • A group-conversation dry run validated the side-chat case and both policy arms with zero model calls. This is harness validation, not a live-model quality measurement.

Earlier authored GPT-6 Luna provenance regressions improved agent/notification attribution from 0/9 to 9/9, retained the direct-human summary control at 3/3, and passed 12/12 learning samples. The updated curator prompt in #166 passed 21/21 samples across seven cases. These small samples demonstrate the reproduced cases; they are not a population accuracy estimate, and the final legacy-summary wording was validated deterministically rather than through a new live-model run.

The combined stack advertises a 74,746-byte MCP tool list, 398 bytes above the 74,348-byte main baseline. The existing context-budget workflow is unchanged; this is the same increase as #166, not an additional increase.

Limits

Legacy or external transcripts containing only a user role cannot establish whether the original sender was a person or an automated actor. This change preserves and checks provenance where canonical metadata exists, and labels text-only historical summary attribution as unverified. It does not reconstruct sender identity absent from the imported transcript.

The explicit-revision recall gate uses conservative pattern matching. Provenance and matching citations establish origin, not truth. Source-backed summaries are revalidated when used; this is not a deployment-wide migration. Original source conversations remain intact, and context a provider has already consumed cannot be unsent. The handoff fix closes the reproduced asynchronous gap before consumption.

This updates code and the PR branch; it does not deploy an environment or rewrite a live database.

Model and harness: GPT-6 Astra Pro in the ChatGPT shared workspace, with delegated implementation and review agents; GPT-6 Luna for the real-model evaluations.

Bind thread knowledge tools to their project and environment. Add bounded,
reversible background memory curation with source and revision validation,
project settings, review history, and user-only restoration across clients.
@changeset-bot

changeset-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c23f17d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Fix the migration ledger, hidden-memory listing, and restore refresh fixtures. Correct Cursor and OpenCode curation test types and record the measured MCP context size.

The agent-context-increase maintainer gate remains required.
Preserve human authorship in native-control fixtures, attribute recorded delegation prompts, and assert hidden task memories through the explicit set-aside view.

Include the updated memory-isolation base while preserving the PR stack.
ScriptedAlchemy and others added 5 commits November 19, 2026 10:12
Apply curator retirement as automatic forgetting, erase stored history and delivery copies, discard non-standing learning proposals, and clean prior automatic retirements in bounded background batches. Remove set-aside browsing from web and mobile while retaining owner protections and manual supersession controls.
AssistedLearning now discards task and code verdicts before saving, so
saveAutomatic no longer takes a verdict or returns "discarded". This also
removes the unreachable "unsupported assertion" note, and the test
fixtures no longer set a standing-check capability that no client reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ation' into fix/agent-message-provenance-wt

# Conflicts:
#	apps/server/src/project/knowledge/AssistedLearning.ts
… names

Server code now calls parseNativeGoalCommand and isNativeCompactionCommand
directly instead of importing them under the ungated contracts names.
Provenance schemas are exported from messageProvenance.ts, and
orchestrationV2.ts no longer re-exports them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ScriptedAlchemy
ScriptedAlchemy changed the base branch from fix/project-memory-isolation-curation to main November 19, 2026 19:39
isScratchProject resolved symlinks only on the Scratch folder side. A
project path under a symlinked directory, such as macOS /var, never
matched. Both sides are now resolved before comparing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ScriptedAlchemy
ScriptedAlchemy merged commit c64e08b into main Nov 19, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant